package com.yuyou.fn.tms.vo;

import com.yuyou.fn.common.constant.ClassLevelEnum;
import com.yuyou.fn.common.lang.Tuple3;
import com.yuyou.fn.common.util.EnumUtils;
import com.yuyou.fn.common.util.Utils;
import com.yuyou.fn.educational.entity.CourseClass;
import com.yuyou.fn.educational.entity.PeriodSegment;
import com.yuyou.fn.educational.entity.Product;
import com.yuyou.fn.platform.entity.City;
import com.yuyou.fn.platform.entity.District;
import com.yuyou.fn.tms.util.PeriodUtils;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class TmsCourseClass {
    /*  0:未开班 1:已开班 2：已作废 3：已结课, 班级状态0已开班 2作废 1未开班,4已结课*/
    static Map<Integer,Integer> classStatusMap=new HashMap<>();
    static {
        classStatusMap.put(0,1);
        classStatusMap.put(1,0);
        classStatusMap.put(2,2);
        classStatusMap.put(3,4);
    }

    @ApiModelProperty("班级id")
    private Long  claId ;//班级id

    @ApiModelProperty("班级名称")
    private String className ;//班级名称

    @ApiModelProperty("班级编号")
    private String claNo ;//班级编号

    @ApiModelProperty("课程模版id")
    private Long clacouTeId ;//课程模版id

    @ApiModelProperty("城市id")
    private Long cityId ;//城市id

    @ApiModelProperty("城市名称")
    private String cityName ;//城市名称

    @ApiModelProperty("管理区域id")
    private Long masId ;//管理区域id

    @ApiModelProperty("管理区域名称")
    private String masName ;//管理区域名称

    @ApiModelProperty("年份")
    private String claYear ;//年份

    @ApiModelProperty("季节id")
    private Long seaId ;//季节id

    @ApiModelProperty("季节名称")
    private String seaName ;//季节名称

    @ApiModelProperty("年级id")
    private String graId ;//年级id

    @ApiModelProperty("年级名称")
    private String graName ;//年级名称

    @ApiModelProperty("学科Id")
    private Long subtId ;//学科Id

    @ApiModelProperty("学科Name")
    private String subtName ;//学科Name

    @ApiModelProperty("层级Id")
    private Long gId ;//层级Id

    @ApiModelProperty("层次Name")
    private String gName ;//层次Name

    @ApiModelProperty("段次id")
    private Long potId ;//段次id

    @ApiModelProperty("段次名称")
    private String potName ;//段次名称

    @ApiModelProperty("辅导班id（校区id）")
    private Long deptId ;//辅导班id（校区id）

    @ApiModelProperty("辅导班名称(校区名称)")
    private String deptName ;//辅导班名称(校区名称)

    @ApiModelProperty("产品id")
    private Long prtId;

    @ApiModelProperty("产品名称")
    private String prtName;

    @ApiModelProperty("课程类别ID")
    private Long coutId ;//课程类别ID

    @ApiModelProperty("课程类别Name")
    private String coutName ;//课程类别Name

    @ApiModelProperty("首次上课起始时间(HH:mm)")
    private String claStartTime ;//首次上课起始时间(HH:mm)

    @ApiModelProperty("首次上课结束时间(HH:mm)")
    private String claEndTime ;//首次上课结束时间(HH:mm)

    @ApiModelProperty("班主任id")
    private Long claSeniorId ;//班主任id

    @ApiModelProperty("班主任姓名")
    private String claSeniorName ;//班主任姓名

    @ApiModelProperty("教室id")
    private Long crId ;//教室id

    @ApiModelProperty("教室名称")
    private String crName ;//教室名称

    @ApiModelProperty("联系电话")
    private String deptCampusTel ;//联系电话

    @ApiModelProperty("班序号")
    private String claOrder ;//班序号

    @ApiModelProperty("开课日期")
    private String claOpenClassTime ;//开课日期

    @ApiModelProperty("学位数、班级名额")
    private Integer claQuota ;//学位数、班级名额

    @ApiModelProperty("已报人数")
    private Integer claRegedNum ;//已报人数

    @ApiModelProperty("已锁学位")
    private Integer lockSeatNum ;//已锁学位

    @ApiModelProperty("总讲数")
    private Integer claNum ;//总讲数

    @ApiModelProperty("资料费")
    private BigDecimal claMaterialFee ;//资料费

    @ApiModelProperty("学费")
    private BigDecimal claFee ;//学费

    @ApiModelProperty("班级状态0已开班 2作废 1未开班,4已结课")
    private Integer claStatus ;//班级状态0已开班 2作废 1未开班,4已结课

    @ApiModelProperty("是否排教室0未排教室 1已排教室")
    private Integer claArrangeRoom ;//是否排教室0未排教室 1已排教室

    @ApiModelProperty("排课状态（未排时间：0，已排时间：1）")
    private Integer claArrangeStatus ;//排课状态（未排时间：0，已排时间：1）

    @ApiModelProperty("排老师状态（未排教师：0，已排教师：1）")
    private Integer claArrTeaStatus ;//排老师状态（未排教师：0，已排教师：1）

    @ApiModelProperty("班级总时长(分钟)")
    private Integer claLong ;//班级总时长(分钟)

    @ApiModelProperty("课程简介")
    private String claInfo ;//课程简介

    @ApiModelProperty("创建时间")
    private Date claCreateTime ;//创建时间

    @ApiModelProperty("修改时间")
    private Date claModifyTime ;//修改时间

    @ApiModelProperty("结课日期")
    private String claEndClassDate ;//结课日期

    @ApiModelProperty("结课日期开始上课时间")
    private String claEndClassStartTime ;//结课日期开始上课时间

    @ApiModelProperty("结课日期下课时间")
    private String claEndClassEndTime ;//结课日期下课时间

    @ApiModelProperty("教师id(多个用英文逗号,隔开)")
    private String claTeacherIds ;//教师id(多个用英文逗号,隔开)

    @ApiModelProperty("教师名称(多个用英文逗号,隔开)")
    private String claTeacherNames ;//教师名称(多个用英文逗号,隔开)

    @ApiModelProperty("已上讲次")
    private int claPastNum ;//已上讲次

    @ApiModelProperty("删除状态0:正常1删除")
    private Integer claIsDeleted ;//删除状态0:正常1删除



    public TmsCourseClass(CourseClass courseClass, City city, District district, PeriodSegment periodSegment, Product product){
        String studyingTime=courseClass.getStudyingTime();
        String startTime="";
        String endTime="";
        if (StringUtils.isNotEmpty(studyingTime)){
            String[] times = studyingTime.split(" ")[0].split("-");
            startTime=times[0];
            endTime=times[1];
        }

        this.setClaId(courseClass.getClassId());//班级id
        this.setClassName(courseClass.getClassAliasName());//班级名称
        this.setClaNo(courseClass.getClassNo());//班级编号
        this.setClacouTeId(courseClass.getCourseTemplateId());//课程模版id
        if (city!=null){
            this.setCityId(city.getCityId());//城市id
            this.setCityName(city.getCityName());//城市名称
        }
        if (district!=null){
            this.setMasId(district.getDistrictId());//管理区域id
            this.setMasName(district.getDistrictName());//管理区域名称
        }


        Tuple3<Long, String, String> sea = PeriodUtils.periodName2Sea(courseClass.getPeriodName());
        this.setClaYear(sea.getSecond());//年份
        this.setSeaId(sea.getFirst());//季节id
        this.setSeaName(sea.getThree());//季节名称
        this.setGraId(courseClass.getGradeId().toString());//年级id
        this.setGraName(courseClass.getGradeName());//年级名称
        this.setSubtId(courseClass.getSubjectId());//学科Id
        this.setSubtName(courseClass.getSubjectName());//学科Name
        this.setgId(courseClass.getLevel().longValue());//层级Id
        this.setgName(EnumUtils.getName(ClassLevelEnum.values(),courseClass.getLevel()));//层次Name
        if (periodSegment!=null){
            this.setPotId(periodSegment.getSegmentId());//段次id
        }
        this.setPotName("第"+courseClass.getSegmentNo()+"段");//段次名称
        this.setDeptId(courseClass.getCampusId());//辅导班id（校区id）
        this.setDeptName(courseClass.getCampusName());//辅导班名称(校区名称)

        if (product!=null){
            this.setPrtId(courseClass.getProductId());
            this.setPrtName(product.getName());
        }
        this.setCoutId(null);//课程类别ID
        this.setCoutName(null);//课程类别Name
        this.setClaStartTime(startTime);//首次上课起始时间(HH:mm)
        this.setClaEndTime(endTime);//首次上课结束时间(HH:mm)
        this.setClaSeniorId(courseClass.getSeniorId());//班主任id
        this.setClaSeniorName(courseClass.getSeniorName());//班主任姓名
        this.setCrId(courseClass.getRoomId());//教室id
        this.setCrName(courseClass.getRoomName());//教室名称
        //this.setDeptCampusTel();//联系电话
        this.setClaOrder("0");//班序号
        this.setClaOpenClassTime(Utils.formatDate(courseClass.getStartCourseTime(),"yyyy-MM-dd"));//开课日期
        this.setClaQuota(courseClass.getQuota());//学位数、班级名额
        this.setClaRegedNum(courseClass.getRegAmount());//已报人数
        this.setLockSeatNum(courseClass.getLockAmount());//已锁学位
        this.setClaNum(courseClass.getLectureAmount());//总讲数
        this.setClaMaterialFee(courseClass.getMaterialFee());//资料费
        this.setClaFee(courseClass.getStudyingFee());//学费
        this.setClaStatus(classStatusMap.get(courseClass.getStatus()));//班级状态0已开班 2作废 1未开班,4已结课
        this.setClaArrangeRoom(courseClass.getIsArrangeRoom());//是否排教室0未排教室 1已排教室
        this.setClaArrangeStatus(courseClass.getIsArrangeTime());//排课状态（未排时间：0，已排时间：1）
        this.setClaArrTeaStatus(courseClass.getIsArrangeTeacher());//排老师状态（未排教师：0，已排教师：1）
        this.setClaLong(courseClass.getLectureAmount()*(courseClass.getLectureDuration()==null?0:courseClass.getLectureDuration()));//班级总时长(分钟)
        this.setClaInfo(courseClass.getCourseDescription());//课程简介
        this.setClaCreateTime(courseClass.getCreateTime());//创建时间
        this.setClaModifyTime(courseClass.getUpdateTime());//修改时间
        this.setClaEndClassDate( Utils.formatDate(courseClass.getEndCourseTime(),"yyyy-MM-dd"));//结课日期
        this.setClaEndClassStartTime(startTime);//结课日期开始上课时间
        this.setClaEndClassEndTime(endTime);//结课日期下课时间
        this.setClaTeacherIds(courseClass.getTeacherIds());//教师id(多个用英文逗号,隔开)
        this.setClaTeacherNames(courseClass.getTeacherNames());//教师名称(多个用英文逗号,隔开)
        this.setClaPastNum(courseClass.getCompletedLectureAmount());//已上讲次
        this.setClaIsDeleted(0);//删除状态0:正常1删除

    }

    public Long getClaId() {
        return claId;
    }

    public void setClaId(Long claId) {
        this.claId = claId;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public String getClaNo() {
        return claNo;
    }

    public void setClaNo(String claNo) {
        this.claNo = claNo;
    }

    public Long getClacouTeId() {
        return clacouTeId;
    }

    public void setClacouTeId(Long clacouTeId) {
        this.clacouTeId = clacouTeId;
    }

    public Long getCityId() {
        return cityId;
    }

    public void setCityId(Long cityId) {
        this.cityId = cityId;
    }

    public String getCityName() {
        return cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }

    public Long getMasId() {
        return masId;
    }

    public void setMasId(Long masId) {
        this.masId = masId;
    }

    public String getMasName() {
        return masName;
    }

    public void setMasName(String masName) {
        this.masName = masName;
    }

    public String getClaYear() {
        return claYear;
    }

    public void setClaYear(String claYear) {
        this.claYear = claYear;
    }

    public Long getSeaId() {
        return seaId;
    }

    public void setSeaId(Long seaId) {
        this.seaId = seaId;
    }

    public String getSeaName() {
        return seaName;
    }

    public void setSeaName(String seaName) {
        this.seaName = seaName;
    }

    public String getGraId() {
        return graId;
    }

    public void setGraId(String graId) {
        this.graId = graId;
    }

    public String getGraName() {
        return graName;
    }

    public void setGraName(String graName) {
        this.graName = graName;
    }

    public Long getSubtId() {
        return subtId;
    }

    public void setSubtId(Long subtId) {
        this.subtId = subtId;
    }

    public String getSubtName() {
        return subtName;
    }

    public void setSubtName(String subtName) {
        this.subtName = subtName;
    }

    public Long getgId() {
        return gId;
    }

    public void setgId(Long gId) {
        this.gId = gId;
    }

    public String getgName() {
        return gName;
    }

    public void setgName(String gName) {
        this.gName = gName;
    }

    public Long getPotId() {
        return potId;
    }

    public void setPotId(Long potId) {
        this.potId = potId;
    }

    public String getPotName() {
        return potName;
    }

    public void setPotName(String potName) {
        this.potName = potName;
    }

    public Long getDeptId() {
        return deptId;
    }

    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public Long getPrtId() {
        return prtId;
    }

    public void setPrtId(Long prtId) {
        this.prtId = prtId;
    }

    public String getPrtName() {
        return prtName;
    }

    public void setPrtName(String prtName) {
        this.prtName = prtName;
    }

    public Long getCoutId() {
        return coutId;
    }

    public void setCoutId(Long coutId) {
        this.coutId = coutId;
    }

    public String getCoutName() {
        return coutName;
    }

    public void setCoutName(String coutName) {
        this.coutName = coutName;
    }

    public String getClaStartTime() {
        return claStartTime;
    }

    public void setClaStartTime(String claStartTime) {
        this.claStartTime = claStartTime;
    }

    public String getClaEndTime() {
        return claEndTime;
    }

    public void setClaEndTime(String claEndTime) {
        this.claEndTime = claEndTime;
    }

    public Long getClaSeniorId() {
        return claSeniorId;
    }

    public void setClaSeniorId(Long claSeniorId) {
        this.claSeniorId = claSeniorId;
    }

    public String getClaSeniorName() {
        return claSeniorName;
    }

    public void setClaSeniorName(String claSeniorName) {
        this.claSeniorName = claSeniorName;
    }

    public Long getCrId() {
        return crId;
    }

    public void setCrId(Long crId) {
        this.crId = crId;
    }

    public String getCrName() {
        return crName;
    }

    public void setCrName(String crName) {
        this.crName = crName;
    }

    public String getDeptCampusTel() {
        return deptCampusTel;
    }

    public void setDeptCampusTel(String deptCampusTel) {
        this.deptCampusTel = deptCampusTel;
    }

    public String getClaOrder() {
        return claOrder;
    }

    public void setClaOrder(String claOrder) {
        this.claOrder = claOrder;
    }

    public String getClaOpenClassTime() {
        return claOpenClassTime;
    }

    public void setClaOpenClassTime(String claOpenClassTime) {
        this.claOpenClassTime = claOpenClassTime;
    }

    public Integer getClaQuota() {
        return claQuota;
    }

    public void setClaQuota(Integer claQuota) {
        this.claQuota = claQuota;
    }

    public Integer getClaRegedNum() {
        return claRegedNum;
    }

    public void setClaRegedNum(Integer claRegedNum) {
        this.claRegedNum = claRegedNum;
    }

    public Integer getLockSeatNum() {
        return lockSeatNum;
    }

    public void setLockSeatNum(Integer lockSeatNum) {
        this.lockSeatNum = lockSeatNum;
    }

    public Integer getClaNum() {
        return claNum;
    }

    public void setClaNum(Integer claNum) {
        this.claNum = claNum;
    }

    public BigDecimal getClaMaterialFee() {
        return claMaterialFee;
    }

    public void setClaMaterialFee(BigDecimal claMaterialFee) {
        this.claMaterialFee = claMaterialFee;
    }

    public BigDecimal getClaFee() {
        return claFee;
    }

    public void setClaFee(BigDecimal claFee) {
        this.claFee = claFee;
    }

    public Integer getClaStatus() {
        return claStatus;
    }

    public void setClaStatus(Integer claStatus) {
        this.claStatus = claStatus;
    }

    public Integer getClaArrangeRoom() {
        return claArrangeRoom;
    }

    public void setClaArrangeRoom(Integer claArrangeRoom) {
        this.claArrangeRoom = claArrangeRoom;
    }

    public Integer getClaArrangeStatus() {
        return claArrangeStatus;
    }

    public void setClaArrangeStatus(Integer claArrangeStatus) {
        this.claArrangeStatus = claArrangeStatus;
    }

    public Integer getClaArrTeaStatus() {
        return claArrTeaStatus;
    }

    public void setClaArrTeaStatus(Integer claArrTeaStatus) {
        this.claArrTeaStatus = claArrTeaStatus;
    }

    public Integer getClaLong() {
        return claLong;
    }

    public void setClaLong(Integer claLong) {
        this.claLong = claLong;
    }

    public String getClaInfo() {
        return claInfo;
    }

    public void setClaInfo(String claInfo) {
        this.claInfo = claInfo;
    }

    public Date getClaCreateTime() {
        return claCreateTime;
    }

    public void setClaCreateTime(Date claCreateTime) {
        this.claCreateTime = claCreateTime;
    }

    public Date getClaModifyTime() {
        return claModifyTime;
    }

    public void setClaModifyTime(Date claModifyTime) {
        this.claModifyTime = claModifyTime;
    }

    public String getClaEndClassDate() {
        return claEndClassDate;
    }

    public void setClaEndClassDate(String claEndClassDate) {
        this.claEndClassDate = claEndClassDate;
    }

    public String getClaEndClassStartTime() {
        return claEndClassStartTime;
    }

    public void setClaEndClassStartTime(String claEndClassStartTime) {
        this.claEndClassStartTime = claEndClassStartTime;
    }

    public String getClaEndClassEndTime() {
        return claEndClassEndTime;
    }

    public void setClaEndClassEndTime(String claEndClassEndTime) {
        this.claEndClassEndTime = claEndClassEndTime;
    }

    public String getClaTeacherIds() {
        return claTeacherIds;
    }

    public void setClaTeacherIds(String claTeacherIds) {
        this.claTeacherIds = claTeacherIds;
    }

    public String getClaTeacherNames() {
        return claTeacherNames;
    }

    public void setClaTeacherNames(String claTeacherNames) {
        this.claTeacherNames = claTeacherNames;
    }

    public int getClaPastNum() {
        return claPastNum;
    }

    public void setClaPastNum(int claPastNum) {
        this.claPastNum = claPastNum;
    }

    public Integer getClaIsDeleted() {
        return claIsDeleted;
    }

    public void setClaIsDeleted(Integer claIsDeleted) {
        this.claIsDeleted = claIsDeleted;
    }
}
